﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using FRL.DebtChased.Silverlight.Library.RichContentService;

namespace FRL.DebtChased.ChaseWorkspace
{

	/// <summary>
	/// Declaration of SwapPanel class
	/// Control for presenting panels on the left side of main page
	/// </summary>
	public partial class SwapPanel : UserControl
	{

		/////////////////////////////////////////////////////////////
		// Constants and Enumerations

		public enum ePanel
		{
			Contacts,
			DebtDetails,
			Expected,
			Invoicing,
			Summary,
			Comments,
			Documents,
			Agent
		}

		/////////////////////////////////////////////////////////////
		// Construction

		public SwapPanel()
		{

			// Load xaml resources
			InitializeComponent();

			// Start with the contacts panel
			SwapPanels(ePanel.Contacts);

		}

		/////////////////////////////////////////////////////////////
		// Operations

		public void SwapPanels( ePanel panel )
		{

			// Show/hide panels
			contactsPanel.Visibility = (panel == ePanel.Contacts) ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;
			summaryPanel.Visibility = (panel == ePanel.Summary) ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;
			agentsPanel.Visibility = (panel == ePanel.Agent) ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;
			docsPanel.Visibility = (panel == ePanel.Documents) ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;

			// Update heading title
			switch(panel)
			{
				case ePanel.Contacts:
					//tbLabel.Text = "Client Details";
					tbLabel.Text = "Debt Details";
					break;
				case ePanel.DebtDetails:
					tbLabel.Text = "Debt Details";
					break;
				case ePanel.Expected:
					tbLabel.Text = "Expected";
					break;
				case ePanel.Invoicing:
					tbLabel.Text = "Invoicing";
					break;
				case ePanel.Summary:
					tbLabel.Text = "Tools";
					break;
				case ePanel.Comments:
					tbLabel.Text = "Comments";
					break;
				case ePanel.Documents:
					tbLabel.Text = "Supporting Documents";
					break;
				case ePanel.Agent:
					tbLabel.Text = "Agents & Legal";
					break;
			} // switch

		}

		public void Set( AccountTransport account )
		{

			// Set panel content
			summaryPanel.Set(account);
			contactsPanel.Set(account);
			agentsPanel.Set(account);
			docsPanel.Set(account);

		}

		public void PostSupportDataLoad()
		{

			// Update panel content
			summaryPanel.PostSupportDataLoad();
			contactsPanel.PostSupportDataLoad();
			agentsPanel.PostSupportDataLoad();
			docsPanel.PostSupportDataLoad();

		}

	}

}
